package com.deepexps.security.controller;

import com.deepexps.security.commen.ResponseResult;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @program: security
 * @description:
 * @author: lvxiwei
 * @create: 2021-11-09 15:24
 **/
@RestController
@RequestMapping("/")
public class TestController {

    @PreAuthorize("hasRole('admin')")
    @RequestMapping("/hello")
    public ResponseResult hello(){
        return ResponseResult.getSuccess("hello");
    }


    @PreAuthorize("hasAuthority('sys:user:list')")
    @RequestMapping("/hello2")
    public ResponseResult hello2(){
        return ResponseResult.getSuccess("hello2");
    }



}
